package com.study.springBoot;

import com.study.springBoot.common.DemoA;
import com.study.springBoot.config.SpringBootConfig;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.SpringBootConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Import;

// implements ApplicationContextAware
@SpringBootApplication
@Import(SpringBootConfig.class)
public class SpringBootStartStudy {

    private static ApplicationContext applicationContext;
    public static void main(String[] args) {
        ConfigurableApplicationContext context = SpringApplication.run(SpringBootStartStudy.class,args);
        //AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();

        //AnnotationConfigApplicationContext context = (AnnotationConfigApplicationContext)applicationContext;
        DemoA bean = context.getBean(DemoA.class);

        System.out.println(bean);


    }

//    @Override
//    public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
//        this.applicationContext = applicationContext;
//    }
}
